package com.gongpingjialoan.data;

import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;

import com.gongpingjialoan.activity.main.MainActivity;
import com.gongpingjialoan.constant.Const;
import com.gongpingjialoan.global.GPJApplication;
import com.gongpingjialoan.network.NetDataJson;
import com.gongpingjialoan.utility.PreferenceUtils;
import com.gongpingjialoan.utility.Utils;

import org.json.JSONException;
import org.json.JSONObject;

public class UserManager {

    private String user = "";

    private String email = "";

    private String phone = "";

    private String user_type = "";

    private String dealer = "";

    private String token = "";

    private boolean is_vip;

    // Dealer
    private String dealer_name = "";

    private String avatar = "";

    private String wx_nickname = "";

    private String xm_nickname = "";

    public String getWx_nickname() {
        return wx_nickname;
    }

    public void setWx_nickname(String wx_nickname) {
        this.wx_nickname = wx_nickname;
    }

    public String getXm_nickname() {
        return xm_nickname;
    }

    public void setXm_nickname(String xm_nickname) {
        this.xm_nickname = xm_nickname;
    }

    private int cars_amount;

    private int recmd_cars_amount;

    private PreferenceUtils mPreferenceUtils;
    String userid = "";

    boolean buy_car_recommend_flag;

    public UserManager(Context context) {
        mPreferenceUtils = new PreferenceUtils(GPJApplication.getInstance());
    }

    public UserManager() {
        mPreferenceUtils = new PreferenceUtils(GPJApplication.getInstance());
    }


    public UserManager(Context context, String user, String email, String phone, String user_type, String dealer,
                       String token, String dealer_name, boolean is_vip, int cars_amount, int recmd_cars_amount) {
        this.user = user;
        this.email = email;
        this.phone = phone;
        this.user_type = user_type;
        this.dealer = dealer;
        this.token = token;
        this.dealer_name = dealer_name;
        this.is_vip = is_vip;
        this.cars_amount = cars_amount;
        this.recmd_cars_amount = recmd_cars_amount;

        mPreferenceUtils = new PreferenceUtils(GPJApplication.getInstance());
    }


    public UserManager(Context context, String user, String email, String phone, String user_type, String dealer,
                       String token, String dealer_name, boolean is_vip, int cars_amount, int recmd_cars_amount, String userid) {
        this.user = user;
        this.email = email;
        this.phone = phone;
        this.user_type = user_type;
        this.dealer = dealer;
        this.token = token;
        this.dealer_name = dealer_name;
        this.is_vip = is_vip;
        this.cars_amount = cars_amount;
        this.recmd_cars_amount = recmd_cars_amount;
        this.userid = userid;

        mPreferenceUtils = new PreferenceUtils(GPJApplication.getInstance());
    }

    public String getUserid() {
        return userid;
    }

    public void setUserid(String userid) {
        this.userid = userid;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getUser_type() {
        return user_type;
    }

    public void setUser_type(String user_type) {
        this.user_type = user_type;
    }

    public String getDealer() {
        return dealer;
    }

    public void setDealer(String dealer) {
        this.dealer = dealer;
    }


    public String getDealer_name() {
        return dealer_name;
    }

    public void setDealer_name(String dealer_name) {
        this.dealer_name = dealer_name;
    }

    public int getCars_amount() {
        return cars_amount;
    }

    public void setCars_amount(int cars_amount) {
        this.cars_amount = cars_amount;
    }

    public int getRecmd_cars_amount() {
        return recmd_cars_amount;
    }

    public void setRecmd_cars_amount(int recmd_cars_amount) {
        this.recmd_cars_amount = recmd_cars_amount;
    }

    public void SaveUserInfo(UserManager userManager) {
        mPreferenceUtils.saveObject(userManager);
    }

    public UserManager LoadUserInfo() {
        return mPreferenceUtils.loadObject(UserManager.class);
    }

    public void loginfromSF(String code, final OnSfLoninResponse onLoginResponse, final boolean isRefreshDiscountCar, String uri) {
        NetDataJson mNetDataJson = new NetDataJson(new NetDataJson.OnNetDataJsonListener() {

            @Override
            public void onDataJsonUpdate(JSONObject data) {
                try {
                    JSONObject j = data.getJSONObject("data");
                    String type = j.getString("action_type");
                    if ("bound_phone".equals(type)) {
                        onLoginResponse.onLoginBindPhone();
                    } else {
                        JSONObject json = j.getJSONObject("login_data");
                        GPJApplication.getInstance().setIslogin(true);
                        UserManager mUserManager =
                                new UserManager(GPJApplication.getInstance(), json.getString("contact"), json.getString("email"),
                                        json.getString("phone"), json.getString("user_type"), json.getString("dealer"), json.getString("token"),
                                        json.getString("dealer_name"), json.getBoolean("is_vip"), 0, 0,json.getString("user_id"));
                        String city = json.getString("default_city");
                        mUserManager.setAvatar(json.getString("avatar"));
                        mUserManager.setBuy_car_recommend_flag(json.getBoolean("buy_car_recommend_flag"));
                        //password =
                        GPJApplication.getInstance().getCityData().mCurrentCity = city;
                        SharedPreferences sharedPreferences = GPJApplication.getInstance().getSharedPreferences("user_city", Context.MODE_PRIVATE);
                        SharedPreferences.Editor edit = sharedPreferences.edit();
                        edit.putString("city", city);
                        edit.commit();
                        if (MainActivity.main != null) {
                            MainActivity.main.currentCity = city;
                        }
                        JSONObject wxJsonObject = json.getJSONObject("wechat_user");
                        if (wxJsonObject != null && wxJsonObject.length() > 0) {
                            mUserManager.setWx_nickname(wxJsonObject.getString("nickname"));
                        }
                        JSONObject xmJsonObject = json.getJSONObject("xiaomi_user");
                        if (xmJsonObject != null && xmJsonObject.length() > 0) {
                            mUserManager.setXm_nickname(xmJsonObject.getString("nickname"));
                        }

                        JSONObject jsonArray = json.getJSONObject("chat_user");
                        String username = jsonArray.getString("username");
                        String password = jsonArray.getString("password");
                        GPJApplication.getInstance().chat_user_id = username;
                        UserManager.this.SaveUserInfo(mUserManager);

                        onLoginResponse.onLoginSuccess();
                        if (MainActivity.main != null) {
                            if (MainActivity.main.mUserHomeFragment.isAdded())
                                MainActivity.main.mUserHomeFragment.refresh();

                            if (MainActivity.main.mRecomendDiscountFragment != null && isRefreshDiscountCar)
                                MainActivity.main.mRecomendDiscountFragment.updateDiscountListData();

                            if (MainActivity.main.assessmentFragment != null && MainActivity.main.assessmentFragment.isAdded()) {
                                MainActivity.main.assessmentFragment.changCity(city);
                                MainActivity.main.assessmentFragment.mMainRecomendView.getRecomendCars();
                                MainActivity.main.assessmentFragment.mMainRecomendView.getBrowseCars();
                            }
                        }
                    }
                } catch (JSONException e) {
                    onLoginResponse.onLoginError(e.toString());
                    GPJApplication.getInstance().setIslogin(false);
                }
            }

            @Override
            public void onDataJsonError(String errorMessage) {
                onLoginResponse.onLoginError(errorMessage);
                GPJApplication.getInstance().setIslogin(false);
            }
        });
        mNetDataJson.setUrl(uri);
        mNetDataJson.addParam("code  ", code);
        mNetDataJson.addParam("appid", Const.WX_APP_KEY);
        mNetDataJson.request("post");

    }


    public void login(final String account, final String password, final boolean isRefreshDiscountCar, final OnLoginResponse onLoginResponse) {
        NetDataJson mNetDataJson = new NetDataJson(new NetDataJson.OnNetDataJsonListener() {

            @Override
            public void onDataJsonUpdate(JSONObject json) {
                try {
                    GPJApplication.getInstance().setIslogin(true);
                    UserManager mUserManager =
                            new UserManager(GPJApplication.getInstance(), json.getString("contact"), json.getString("email"),
                                    json.getString("phone"), json.getString("user_type"), json.getString("dealer"), json.getString("token"),
                                    json.getString("dealer_name"), json.getBoolean("is_vip"), 0, 0, json.getString("user_id"));
                    String city = json.getString("default_city");
                    mUserManager.setAvatar(json.getString("avatar"));
                    mUserManager.setBuy_car_recommend_flag(json.getBoolean("buy_car_recommend_flag"));
                    //password =
                    GPJApplication.getInstance().getCityData().mCurrentCity = city;
                    SharedPreferences sharedPreferences = GPJApplication.getInstance().getSharedPreferences("user_city", Context.MODE_PRIVATE);
                    SharedPreferences.Editor edit = sharedPreferences.edit();
                    edit.putString("city", city);
                    edit.commit();
                    if (MainActivity.main != null) {
                        MainActivity.main.currentCity = city;
                    }
                    JSONObject wxJsonObject = json.getJSONObject("wechat_user");
                    if (wxJsonObject != null && wxJsonObject.length() > 0) {
                        mUserManager.setWx_nickname(wxJsonObject.getString("nickname"));
                    }
                    JSONObject xmJsonObject = json.getJSONObject("xiaomi_user");
                    if (xmJsonObject != null && xmJsonObject.length() > 0) {
                        mUserManager.setXm_nickname(xmJsonObject.getString("nickname"));
                    }

                    JSONObject jsonArray = json.getJSONObject("chat_user");
                    String username = jsonArray.getString("username");
                    String password = jsonArray.getString("password");
                    GPJApplication.getInstance().chat_user_id = username;
                    Utils.LogD("环信聊天 " + "username:  " + username + "password :" + password);
                    UserManager.this.SaveUserInfo(mUserManager);

                    Utils.LogD("checkLogin loginWithVerifyCode mUserManager save token :" + json.getString("token"));
                    onLoginResponse.onLoginSuccess(mUserManager);
                    if (MainActivity.main != null) {
                        if (MainActivity.main.mUserHomeFragment.isAdded())
                            MainActivity.main.mUserHomeFragment.refresh();

                        if (MainActivity.main.mRecomendDiscountFragment != null && isRefreshDiscountCar)
                            MainActivity.main.mRecomendDiscountFragment.updateDiscountListData();

                        if (MainActivity.main.assessmentFragment != null && MainActivity.main.assessmentFragment.isAdded()) {
                            MainActivity.main.assessmentFragment.changCity(city);
                            MainActivity.main.assessmentFragment.mMainRecomendView.getRecomendCars();
                            MainActivity.main.assessmentFragment.mMainRecomendView.getBrowseCars();
                        }

                    }
                } catch (JSONException e) {
                    onLoginResponse.onLoginError(e.toString());
                    GPJApplication.getInstance().setIslogin(false);
                }
            }

            @Override
            public void onDataJsonError(String errorMessage) {
                onLoginResponse.onLoginError(errorMessage);
                GPJApplication.getInstance().setIslogin(false);
            }
        });
        String url = "/mobile/account/login/";
//        String params = "?account=" + account + "&password=" + password;
        mNetDataJson.setUrl(url);
        mNetDataJson.addParam("login_type ", "username_password");
        mNetDataJson.addParam("account", account);
        mNetDataJson.addParam("password", password);
        mNetDataJson.request("post");

    }

    public void loginWithVerifyCode(final String phone, final String captcha, final boolean isRefreshDiscountCar, final OnLoginResponse onLoginResponse, String url) {
        final String finalUrl = url;
        NetDataJson mNetDataJson = new NetDataJson(new NetDataJson.OnNetDataJsonListener() {

            @Override
            public void onDataJsonUpdate(JSONObject data) {
                try {
                    JSONObject json;
                    if (!TextUtils.isEmpty(finalUrl)) {
                        json = data.getJSONObject("data");
                    } else {
                        json = data;
                    }
                    GPJApplication.getInstance().setIslogin(true);
                    UserManager mUserManager =
                            new UserManager(GPJApplication.getInstance(), json.getString("contact"), json.getString("email"),
                                    json.getString("phone"), json.getString("user_type"), json.getString("dealer"), json.getString("token"),
                                    json.getString("dealer_name"), json.getBoolean("is_vip"), 0, 0,json.getString("user_id"));
                    String city = json.getString("default_city");
                    mUserManager.setAvatar(json.getString("avatar"));
                    mUserManager.setBuy_car_recommend_flag(json.getBoolean("buy_car_recommend_flag"));
                    GPJApplication.getInstance().getCityData().mCurrentCity = city;
                    SharedPreferences sharedPreferences = GPJApplication.getInstance().getSharedPreferences("user_city", Context.MODE_PRIVATE);
                    SharedPreferences.Editor edit = sharedPreferences.edit();
                    edit.putString("city", city);
                    edit.commit();
                    if (MainActivity.main != null) {
                        MainActivity.main.currentCity = city;
                    }
                    JSONObject wxJsonObject = json.getJSONObject("wechat_user");
                    if (wxJsonObject != null && wxJsonObject.length() > 0) {
                        mUserManager.setWx_nickname(wxJsonObject.getString("nickname"));
                    }
                    JSONObject xmJsonObject = json.getJSONObject("xiaomi_user");
                    if (xmJsonObject != null && xmJsonObject.length() > 0) {
                        mUserManager.setXm_nickname(xmJsonObject.getString("nickname"));
                    }
                    JSONObject jsonArray = json.getJSONObject("chat_user");
                    String username = jsonArray.getString("username");
                    String password = jsonArray.getString("password");
                    GPJApplication.getInstance().chat_user_id = username;
                    UserManager.this.SaveUserInfo(mUserManager);
                    onLoginResponse.onLoginSuccess(mUserManager);
                    if (MainActivity.main != null) {
                        if (MainActivity.main.mUserHomeFragment.isAdded())
                            MainActivity.main.mUserHomeFragment.refresh();

                        if (MainActivity.main.mRecomendDiscountFragment != null && isRefreshDiscountCar)
                            MainActivity.main.mRecomendDiscountFragment.updateDiscountListData();

                        if (MainActivity.main.assessmentFragment != null && MainActivity.main.assessmentFragment.isAdded()) {
                            MainActivity.main.assessmentFragment.changCity(city);
                            MainActivity.main.assessmentFragment.mMainRecomendView.getRecomendCars();
                            MainActivity.main.assessmentFragment.mMainRecomendView.getBrowseCars();
                        }

                    }
                } catch (JSONException e) {
                    onLoginResponse.onLoginError(e.toString());
                    GPJApplication.getInstance().setIslogin(false);
                }
            }

            @Override
            public void onDataJsonError(String errorMessage) {
                onLoginResponse.onLoginError(errorMessage);
                GPJApplication.getInstance().setIslogin(false);
            }
        });
        if (TextUtils.isEmpty(url)) {
            url = "/mobile/account/login/";
        }
        mNetDataJson.setUrl(url);
        mNetDataJson.addParam("phone", phone);
        mNetDataJson.addParam("captcha", captcha);
        mNetDataJson.addParam("login_type ", "mobile_captcha");
        //  mNetDataJson.setUseHttps(false);
        mNetDataJson.request("post");

    }

    public void Logout(final OnLogoutResponse onLogoutResponse) {
        NetDataJson mNetDataJson = new NetDataJson(new NetDataJson.OnNetDataJsonListener() {

            @Override
            public void onDataJsonUpdate(JSONObject json) {
                onLogoutResponse.onLogoutSuccess();
                mPreferenceUtils.clearObject(UserManager.class);
                GPJApplication.getInstance().chat_user_id = "";
            }

            @Override
            public void onDataJsonError(String errorMessage) {
                onLogoutResponse.onLogoutError(errorMessage);
            }
        });
        String url = "/mobile/account/logout/";
        mNetDataJson.setUrl(url);
        //mNetDataJson.setUseHttps(false);
        mNetDataJson.request("get");
    }

    public void CheckLogin(final OnCheckLoginResponse onCheckLoginResponse) {
        final UserManager user = this.LoadUserInfo();
        if (null == user) {
            GPJApplication.getInstance().setIslogin(false);
            onCheckLoginResponse.onCheckLoginError("获取用户信息失败，请重试");
        }
        NetDataJson mNetDataJson = new NetDataJson(new NetDataJson.OnNetDataJsonListener() {

            @Override
            public void onDataJsonUpdate(JSONObject json) {
                try {
                    GPJApplication.getInstance().setIslogin(true);
                    user.setToken(json.getString("token"));
                    user.setIs_vip(json.getBoolean("is_vip"));
                    String city = json.getString("default_city");
                    SharedPreferences sharedPreferences = GPJApplication.getInstance().getSharedPreferences("user_city", Context.MODE_PRIVATE);
                    SharedPreferences.Editor edit = sharedPreferences.edit();
                    edit.putString("city", city);
                    edit.commit();
                    if (MainActivity.main != null) {
                        MainActivity.main.currentCity = city;
                    }
                    JSONObject wxJsonObject = json.getJSONObject("wechat_user");
                    if (wxJsonObject != null && wxJsonObject.length() > 0) {
                        user.setWx_nickname(wxJsonObject.getString("nickname"));
                    }
                    JSONObject xmJsonObject = json.getJSONObject("xiaomi_user");
                    if (xmJsonObject != null && xmJsonObject.length() > 0) {
                        user.setXm_nickname(xmJsonObject.getString("nickname"));
                    }
                    GPJApplication.getInstance().getCityData().mCurrentCity = city;
                    UserManager.this.SaveUserInfo(user);
                    JSONObject jsonArray = json.getJSONObject("chat_user");
                    String username = jsonArray.getString("username");
                    GPJApplication.getInstance().chat_user_id = username;
                    onCheckLoginResponse.onCheckLoginSuccess();
                    if (MainActivity.main != null) {
                        if (MainActivity.main.mUserHomeFragment.isAdded())
                            MainActivity.main.mUserHomeFragment.refresh();
                        if (MainActivity.main.mRecomendDiscountFragment != null)
                            MainActivity.main.mRecomendDiscountFragment.updateDiscountListData();
                    }
                } catch (JSONException e) {
                    onCheckLoginResponse.onCheckLoginError(e.getMessage());
                    Utils.LogD("checkLogin onCheckLoginError1 ");
                    GPJApplication.getInstance().setIslogin(false);
                }
            }

            @Override
            public void onDataJsonError(String errorMessage) {
                onCheckLoginResponse.onCheckLoginError(errorMessage);
                GPJApplication.getInstance().setIslogin(false);
            }
        });
        String url = "/mobile/account/check-login/";
        if (null != user) {
            mNetDataJson.setUrl(url);
            mNetDataJson.addParam("phone", user.getPhone());
            //老版本升级后第一次登陆时，token为空，本地以前缓存的password不为空，此时传password
            mNetDataJson.addParam("token", user.getToken());
            Utils.LogD("checkLogin user.getToken() " + user.getToken());
            //  mNetDataJson.setUseHttps(false);
            mNetDataJson.request("post");
        } else {
            onCheckLoginResponse.onCheckLoginError("获取用户信息失败，请重新登录。");
        }

    }

    public void Register(final String phone, final String password, final String captcha,
                         final OnRegistResponse onRegistResponse) {
        NetDataJson mNetDataJson = new NetDataJson(new NetDataJson.OnNetDataJsonListener() {

            @Override
            public void onDataJsonUpdate(JSONObject json) {
                onRegistResponse.onRegistSuccess();
            }

            @Override
            public void onDataJsonError(String errorMessage) {
                onRegistResponse.onRegistError(errorMessage);
            }
        });
        String url = "/mobile/account/reg/";
        //  String params = "?phone=" + phone + "&password=" + password + "&captcha=" + captcha;
        mNetDataJson.setUrl(url);
        mNetDataJson.addParam("phone", phone);
        mNetDataJson.addParam("password", password);
        mNetDataJson.addParam("captcha", captcha);
        //mNetDataJson.setUseHttps(false);
        mNetDataJson.request("post");
    }

    public void GetRegCaptcha(final String phone, final OnGetRegCaptchaResponse onGetRegCaptchaResponse) {
        NetDataJson mNetDataJson = new NetDataJson(new NetDataJson.OnNetDataJsonListener() {

            @Override
            public void onDataJsonUpdate(JSONObject json) {
                onGetRegCaptchaResponse.onGetRegCaptchaSuccess();
            }

            @Override
            public void onDataJsonError(String errorMessage) {
                onGetRegCaptchaResponse.onGetRegCaptchaError(errorMessage);
            }
        });
        String url = "/mobile/account/get-reg-captcha/";
//        String params = "?phone=" + phone;
        mNetDataJson.setUrl(url);
        // mNetDataJson.setUseHttps(false);
        mNetDataJson.addParam("phone", phone);
        mNetDataJson.request("post");
    }

    public void RetrievePsw(final String phone, final String captcha, final OnRetrievePswResponse onRetrievePswResponse) {
        NetDataJson mNetDataJson = new NetDataJson(new NetDataJson.OnNetDataJsonListener() {

            @Override
            public void onDataJsonUpdate(JSONObject json) {
                onRetrievePswResponse.onRetrievePswSuccess();
            }

            @Override
            public void onDataJsonError(String errorMessage) {
                onRetrievePswResponse.onRetrievePswError(errorMessage);
            }
        });
        String url = "/mobile/account/retrieve-password/";
//        String params = "?phone=" + phone + "&captcha=" + captcha;
        mNetDataJson.setUrl(url);
        // mNetDataJson.setUseHttps(false);
        mNetDataJson.addParam("phone", phone);
        mNetDataJson.addParam("captcha", captcha);
        mNetDataJson.request("post");
    }


    public void NewResetPsw(final String phone, final String captcha, final String new_password,
                            final OnResetPswResponse onResetPswResponse) {
        NetDataJson mNetDataJson = new NetDataJson(new NetDataJson.OnNetDataJsonListener() {

            @Override
            public void onDataJsonUpdate(JSONObject json) {
                onResetPswResponse.onResetPswSuccess();
            }

            @Override
            public void onDataJsonError(String errorMessage) {
                onResetPswResponse.onResetPswError(errorMessage);
            }
        });
        String url = "/mobile/account/forget-password/";
        //String params = "?phone=" + phone + "&captcha=" + captcha + "&new_password=" + new_password;
        mNetDataJson.setUrl(url);
        mNetDataJson.addParam("phone", phone);
        mNetDataJson.addParam("captcha", captcha);
        mNetDataJson.addParam("new_password", new_password);
        //   mNetDataJson.setUseHttps(false);
        mNetDataJson.request("post");
    }

    public void ModifyPsw(final String old_password, final String new_password1, final String new_password2,
                          final OnModifyPswResponse onModifyPswResponse) {
        NetDataJson mNetDataJson = new NetDataJson(new NetDataJson.OnNetDataJsonListener() {

            @Override
            public void onDataJsonUpdate(JSONObject json) {
                onModifyPswResponse.onModifySuccess();
            }

            @Override
            public void onDataJsonError(String errorMessage) {
                onModifyPswResponse.onModifyError(errorMessage);
            }
        });
        String url = "/mobile/account/modify-password/";
        mNetDataJson.setUrl(url);
        mNetDataJson.addParam("old_password", old_password);
        mNetDataJson.addParam("new_password1", new_password1);
        mNetDataJson.addParam("new_password2", new_password2);
        // mNetDataJson.setUseHttps(false);
//        String params =
//            "?old_password=" + old_password + "&new_password1=" + new_password1 + "&new_password2=" + new_password2;
        mNetDataJson.request("post");

    }

    public boolean is_vip() {
        return is_vip;
    }

    public void setIs_vip(boolean is_vip) {
        this.is_vip = is_vip;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public boolean isBuy_car_recommend_flag() {
        return buy_car_recommend_flag;
    }

    public void setBuy_car_recommend_flag(boolean buy_car_recommend_flag) {
        this.buy_car_recommend_flag = buy_car_recommend_flag;
    }

    public interface OnLoginResponse {
        void onLoginSuccess(UserManager user);

        void onLoginError(String errorMessage);
    }

    public interface OnLogoutResponse {
        void onLogoutSuccess();

        void onLogoutError(String errorMessage);
    }

    public interface OnCheckLoginResponse {
        void onCheckLoginSuccess();

        void onCheckLoginError(String errorMessage);
    }

    public interface OnRegistResponse {
        void onRegistSuccess();

        void onRegistError(String errorMessage);
    }

    public interface OnGetRegCaptchaResponse {
        void onGetRegCaptchaSuccess();

        void onGetRegCaptchaError(String errorMessage);
    }

    public interface OnRetrievePswResponse {
        void onRetrievePswSuccess();

        void onRetrievePswError(String errorMessage);
    }

    public interface OnGetPwdCaptchaResponse {
        void onGetPwdCaptchaSuccess();

        void onGetPwdCaptchaError(String errorMessage);
    }

    public interface OnResetPswResponse {
        void onResetPswSuccess();

        void onResetPswError(String errorMessage);
    }

    public interface OnModifyPswResponse {
        void onModifySuccess();

        void onModifyError(String errorMessage);
    }


    public interface OnSfLoninResponse {
        void onLoginSuccess();

        void onLoginBindPhone();

        void onLoginError(String errorMessage);
    }

}
